package com.czk.netty.netty.inboundandoutboundhandler.server;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @Author:ChenZhangKun
 * @Date: 2021/1/20 22:37
 */
public class MyServerHandler extends SimpleChannelInboundHandler<Long> {
    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, Long aLong) throws Exception {
        System.out.println("从客户端读取的long" + channelHandlerContext.channel().remoteAddress() + "  "+aLong);
        channelHandlerContext.writeAndFlush(aLong);
        // 给客户端发送数据
        channelHandlerContext.writeAndFlush(98765L);
    }
}
